//
//  CookCollectionViewCell.m
//  美食百科
//
//  Created by dllo on 16/1/27.
//  Copyright © 2016年 doll. All rights reserved.
//

#import "CookCollectionViewCell.h"
#import "ClassModel.h"
@interface CookCollectionViewCell()
@property(nonatomic,retain)UILabel *nameLabel;
@end
@implementation CookCollectionViewCell
- (void)dealloc
{
    [_cook release];
    [_nameLabel release];
    [super dealloc];
    
}

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.nameLabel = [[UILabel alloc]init];
        self.nameLabel.textColor = self.color;

        self.nameLabel.textAlignment = NSTextAlignmentCenter;
        [self.contentView addSubview:self.nameLabel];
        [_nameLabel release];
    }
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    
    self.nameLabel.frame = self.bounds;
}
-(void)setCook:(ClassModel *)cook
{
    if (_cook != cook) {
        [_cook release];
        _cook = [cook retain];
        
    }
    
    self.nameLabel.text = cook.name;
}


@end
